// google test docs
// wiki page: https://code.google.com/p/googletest/w/list
// primer: https://code.google.com/p/googletest/wiki/V1_7_Primer
// FAQ: https://code.google.com/p/googletest/wiki/FAQ
// advanced guide: https://code.google.com/p/googletest/wiki/V1_7_AdvancedGuide
// samples: https://code.google.com/p/googletest/wiki/V1_7_Samples
//
// List of some basic tests fuctions:
// Fatal assertion                      Nonfatal assertion
// Verifies / Description
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// ASSERT_EQ(expected, actual);         EXPECT_EQ(expected, actual);
// expected == actual
// ASSERT_NE(val1, val2);               EXPECT_NE(val1, val2); val1 != val2
// ASSERT_LT(val1, val2);               EXPECT_LT(val1, val2); val1 < val2
// ASSERT_LE(val1, val2);               EXPECT_LE(val1, val2); val1 <= val2
// ASSERT_GT(val1, val2);               EXPECT_GT(val1, val2); val1 > val2
// ASSERT_GE(val1, val2);               EXPECT_GE(val1, val2); val1 >= val2
//
// ASSERT_FLOAT_EQ(expected, actual);   EXPECT_FLOAT_EQ(expected, actual);   the
// two float values are almost equal (4 ULPs)
// ASSERT_DOUBLE_EQ(expected, actual);  EXPECT_DOUBLE_EQ(expected, actual);  the
// two double values are almost equal (4 ULPs)
// ASSERT_NEAR(val1, val2, abs_error);  EXPECT_NEAR(val1, val2, abs_error);  the
// difference between val1 and val2 doesn't exceed the given absolute error
//=======================================================================================================================================================

#include "gtest/gtest.h"
#include <ros/ros.h>

// Because node and nodelet usually offer the same functionality, the nodelet
// test is only here to test
// whether the nodelet starts and stops correcly. All the unittests can go to
// the node test.

TEST(image_preproc_ros_tool, disp2pointcloud_test_initialization) {
  auto init_delay = ros::NodeHandle("~").param("init_delay", 3.);
  ros::Duration(init_delay).sleep();
  ASSERT_TRUE(ros::ok()) << "Ros crashed or the nodelet failed to initialize!";
}

int main(int argc, char **argv) {
  testing::InitGoogleTest(&argc, argv);
  ros::init(argc, argv, "disp2pointcloud_nodelet_test");
  // The async spinner lets you publish and receive messages during the tests,
  // no need to call spinOnce()
  ros::AsyncSpinner spinner(1);
  spinner.start();
  int ret = RUN_ALL_TESTS();
  ros::shutdown();
  return ret;
}
